#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll rr() {
    ll s = 0, w = false, c = getchar();
    for (; !isdigit(c); c = getchar())
        w = w || c == '-';
    for (; isdigit(c); c = getchar())
        s = s * 10 + c - '0';
    return w ? -s : s;
}

// END OF HEADER

int main() {
    int n = rr(), k = rr();
    vector<int> v(n);
    for (int i = 0; i < n; i++)
        v[i] = rr();
    auto kth = v.begin() + k - 1;
    // sort(v.begin(), v.end());
    nth_element(v.begin(), kth, v.end());
    printf("%d", *kth);
    return 0;
}
